package com.ce.util;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.ce.framework.datamaintain.logic.ISQLMapper;

public class TreeNode implements Serializable
{
	private static final long serialVersionUID = 1L;

	private String vcId;
    
    private String vcName;
    
    private String vcUserData;
    
    private String vcParId;
    
    public static ISQLMapper<TreeNode> mapper2 = new ISQLMapper<TreeNode>(){
		public TreeNode fromSQLQuery(ResultSet rs, int num) {
			TreeNode n = new TreeNode();
			try {
				n.setVcId(rs.getString(1));
				n.setVcName(rs.getString(2));
			} catch (SQLException e) {
				e.printStackTrace();
			}
			return n;
		}
	};

    public static ISQLMapper<TreeNode> mapper3 = new ISQLMapper<TreeNode>(){
		public TreeNode fromSQLQuery(ResultSet rs, int num) {
			TreeNode n = new TreeNode();
			try {
				n.setVcId(rs.getString(1));
				n.setVcName(rs.getString(2));
				n.setVcParId(rs.getString(3));
			} catch (SQLException e) {
				e.printStackTrace();
			}
			return n;
		}
	};

    public static ISQLMapper<TreeNode> mapper4 = new ISQLMapper<TreeNode>(){
		public TreeNode fromSQLQuery(ResultSet rs, int num) {
			TreeNode n = new TreeNode();
			try {
				n.setVcId(rs.getString(1));
				n.setVcName(rs.getString(2));
				n.setVcParId(rs.getString(3));
				n.setVcUserData(rs.getString(4));
			} catch (SQLException e) {
				e.printStackTrace();
			}
			return n;
		}
	};

    public TreeNode(String vcId, String vcName) {
        this.vcId = vcId;
        this.vcName = vcName;
    }

    public TreeNode(String vcId, String vcName, String vcParId) {
        super();
        // TODO �Զ���ɹ��캯����
        this.vcId = vcId;
        this.vcName = vcName;
        this.vcParId = vcParId;
    }

    public TreeNode(String vcId, String vcName, String vcParId, String vcUserData) {
        super();
        // TODO �Զ���ɹ��캯����
        this.vcId = vcId;
        this.vcName = vcName;
        this.vcUserData = vcUserData;
        this.vcParId = vcParId;
    }

    public TreeNode() {
	}

	public String getVcParId() {
        return vcParId;
    }

    public void setVcParId(String vcParId) {
        this.vcParId = vcParId;
    }

    public String getVcId() {
        return vcId;
    }

    public void setVcId(String vcId) {
        this.vcId = vcId;
    }

    public String getVcName() {
        return vcName;
    }

    public void setVcName(String vcName) {
        this.vcName = vcName;
    }

    public String getVcUserData() {
        return vcUserData;
    }

    public void setVcUserData(String vcUserData) {
        this.vcUserData = vcUserData;
    }

	public boolean equals(Object arg0) {
		
		if(!(arg0 instanceof TreeNode))return false;
		TreeNode obj = (TreeNode) arg0;
		if(obj.getVcId()==null && this.vcId==null)return true;
		return obj.getVcId().equals(this.vcId);
	}
    
}
